import 'package:flutter_deer/generated/json/base/json_convert_content.dart';
import 'package:flutter_deer/shop/models/user_entity.dart';

UserInfoEntity $UserInfoEntityFromJson(Map<String, dynamic> json) {
	final UserInfoEntity userInfoEntity = UserInfoEntity();
	final UserEntity? sysUser = jsonConvert.convert<UserEntity>(json['sysUser']);
	if (sysUser != null) {
		userInfoEntity.sysUser = sysUser;
	}
	return userInfoEntity;
}

Map<String, dynamic> $UserInfoEntityToJson(UserInfoEntity entity) {
	final Map<String, dynamic> data = <String, dynamic>{};
	data['sysUser'] = entity.sysUser;
	return data;
}

UserAvatarEntity $UserAvatarEntityFromJson(Map<String, dynamic> json) {
	final UserAvatarEntity userAvatarEntity = UserAvatarEntity();
	final String? avatar = jsonConvert.convert<String>(json['avatar']);
	if (avatar != null) {
		userAvatarEntity.avatar = avatar;
	}
	final String? username = jsonConvert.convert<String>(json['username']);
	if (username != null) {
		userAvatarEntity.username = username;
	}
	return userAvatarEntity;
}

Map<String, dynamic> $UserAvatarEntityToJson(UserAvatarEntity entity) {
	final Map<String, dynamic> data = <String, dynamic>{};
	data['avatar'] = entity.avatar;
	data['username'] = entity.username;
	return data;
}

UserEntity $UserEntityFromJson(Map<String, dynamic> json) {
	final UserEntity userEntity = UserEntity();
	final String? avatar = jsonConvert.convert<String>(json['avatar']);
	if (avatar != null) {
		userEntity.avatar = avatar;
	}
	final String? username = jsonConvert.convert<String>(json['username']);
	if (username != null) {
		userEntity.username = username;
	}
	final String? accountId = jsonConvert.convert<String>(json['accountId']);
	if (accountId != null) {
		userEntity.accountId = accountId;
	}
	final String? shareCode = jsonConvert.convert<String>(json['shareCode']);
	if (shareCode != null) {
		userEntity.shareCode = shareCode;
	}
	final String? phone = jsonConvert.convert<String>(json['phone']);
	if (phone != null) {
		userEntity.phone = phone;
	}
	final String? perfect = jsonConvert.convert<String>(json['perfect']);
	if(perfect!=null){
		userEntity.perfect = perfect;
	}
	final String? nickname = jsonConvert.convert<String>(json['nickname']);
	if(nickname!=null){
		userEntity.nickname = nickname;
	}
	return userEntity;
}

Map<String, dynamic> $UserEntityToJson(UserEntity entity) {
	final Map<String, dynamic> data = <String, dynamic>{};
	data['avatar'] = entity.avatar;
	data['username'] = entity.username;
	data['accountId'] = entity.accountId;
	data['shareCode'] = entity.shareCode;
	data['phone'] = entity.phone;
	data['perfect'] = entity.perfect;
	data['nickname'] = entity.nickname;
	return data;
}

UserPasswordLoginEntity $UserPasswordLoginEntityFromJson(Map<String, dynamic> json) {
  final UserPasswordLoginEntity loginEntity = UserPasswordLoginEntity();
	final String? username = jsonConvert.convert<String>(json['username']);
	if (username != null) {
		loginEntity.username = username;
	}
	final String? password = jsonConvert.convert<String>(json['password']);
	if (password != null) {
		loginEntity.password = password;
	}
	return loginEntity;
}

Map<String, dynamic> $UserPasswordLoginEntityToJson(UserPasswordLoginEntity entity) {
	final Map<String, dynamic> data = <String, dynamic>{};
	data['username'] = entity.username;
	data['password'] = entity.password;
	return data;
}

UserTokenEntity $UserTokenEntityFromJson(Map<String, dynamic> json) {
	final UserTokenEntity userTokenEntity = UserTokenEntity();
	final String? accessToken = jsonConvert.convert<String>(json['access_token']);
	if (accessToken != null) {
		userTokenEntity.accessToken = accessToken;
	}
	final String? refreshToken = jsonConvert.convert<String>(json['refresh_token']);
	if (refreshToken != null) {
		userTokenEntity.refreshToken = refreshToken;
	}
	final String? tokenType = jsonConvert.convert<String>(json['token_type']);
	if (tokenType != null) {
		userTokenEntity.tokenType = tokenType;
	}
	final String? userId = jsonConvert.convert<String>(json['user_id']);
	if (userId != null) {
		userTokenEntity.userId = userId;
	}
	final String? username = jsonConvert.convert<String>(json['username']);
	if (username != null) {
		userTokenEntity.username = username;
	}
	final String? perfect = jsonConvert.convert<String>(json['perfect']);
	if (perfect != null) {
		userTokenEntity.perfect = perfect;
	}
	final int? expiresIn = jsonConvert.convert<int>(json['expires_in']);
	if (expiresIn != null) {
		userTokenEntity.expiresIn = expiresIn;
	}
	final bool? active = jsonConvert.convert<bool>(json['active']);
	if (active != null) {
		userTokenEntity.active = active;
	}
	return userTokenEntity;
}

Map<String, dynamic> $UserTokenEntityToJson(UserTokenEntity entity) {
	final Map<String, dynamic> data = <String, dynamic>{};
	data['accessToken'] = entity.accessToken;
	data['refreshToken'] = entity.refreshToken;
	data['tokenType'] = entity.tokenType;
	data['expiresIn'] = entity.expiresIn;
	data['active'] = entity.active;
	data['userId'] = entity.userId;
	data['username'] = entity.username;
	data['perfect'] = entity.perfect;
	return data;
}